[NTG-context] Re: Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-25 Thread Gerion Entrup
. short .. "]") > end > end > \stopluacode > \definebtx[aps:cite:special][aps:cite] > \startsetups btx:aps:cite:special > \btxcitereference > \ctxlua{render_cite([==[\btxflush{year}]==], [==[\btxflush{author}]==])} > \stopsetups > % use it with \

[NTG-context] Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-23 Thread Gerion Entrup
author}]==])} \stopsetups % use it with \cite[special][knuth1] ``` This has several problems: - \btxflush{short} does not work as I expected that. How can I get the short form? - \btxflush to pass arguments to lua does not work as intended. On the lua side the variable "author"

[NTG-context] Re: \luaescapestring in proper Lua

2024-04-11 Thread Pablo Rodriguez via ntg-context
On 4/11/24 18:56, Hans Hagen via ntg-context wrote: > [...] >>> \protected\def\PrintTheThing{\ctxlua{document.print_the_thing()}} >> >> Sorry, but why \protected is required or recommended here? > > depends if you want it to be expandable I see now that "still.pdf" has a full chapter (#3, titled

[NTG-context] Re: \luaescapestring in proper Lua

2024-04-11 Thread Hans Hagen via ntg-context
On 4/11/2024 5:07 PM, Pablo Rodriguez via ntg-context wrote: On 4/10/24 21:48, Hans Hagen via ntg-context wrote: On 4/10/2024 7:49 PM, Pablo Rodriguez via ntg-context wrote: [...] I wonder whether there is a proper way in the Lua code to avoid [[\luaescapestring{}]] in \ctxlua

[NTG-context] Re: \luaescapestring in proper Lua

2024-04-11 Thread Pablo Rodriguez via ntg-context
On 4/10/24 21:48, Hans Hagen via ntg-context wrote: > On 4/10/2024 7:49 PM, Pablo Rodriguez via ntg-context wrote: >> [...] >> I wonder whether there is a proper way in the Lua code to avoid >> [[\luaescapestring{}]] in \ctxlua. >> [...] > context(tokens.s

[NTG-context] Re: \luaescapestring in proper Lua

2024-04-10 Thread Hans Hagen via ntg-context
([[\luaescapestring{#1}]])}} \PrintTheThing{a \em b {c}} \stoptext I wonder whether there is a proper way in the Lua code to avoid [[\luaescapestring{}]] in \ctxlua. BTW, [[\luaescapestring{}]] in \ctxlua works better for me, since in my real world document, I’m using str:match() to check

[NTG-context] \luaescapestring in proper Lua

2024-04-10 Thread Pablo Rodriguez via ntg-context
wonder whether there is a proper way in the Lua code to avoid [[\luaescapestring{}]] in \ctxlua. BTW, [[\luaescapestring{}]] in \ctxlua works better for me, since in my real world document, I’m using str:match() to check whether the string ends with interrogation or exclamation marks

[NTG-context] Lua and inject.path to make a disconnected MetaPost path?

2024-01-08 Thread Gavin via ntg-context
Hello LuaMetaFun Fans, Can I use mp.inject.path in Lua to create a disconnected path in MetaPost? This is for my module that draws globes. I currently do something like this for drawing the continents. (This MWE has two triangular continents.) \startluacode continents = {} continents[1

[NTG-context] Re: LMTX: Command handling, Interface between TeX and Lua

2023-12-14 Thread Gerion Entrup
Am Mittwoch, 13. Dezember 2023, 21:57:35 CET schrieb Bruce Horrocks: > > > On 13 Dec 2023, at 17:13, Gerion Entrup wrote: > > > > Is there a simple way to define a new command/environment and handle > > the keyword arguments in Lua? For example defining a frontend co

[NTG-context] Re: LMTX: Command handling, Interface between TeX and Lua

2023-12-13 Thread Bruce Horrocks
> On 13 Dec 2023, at 17:13, Gerion Entrup wrote: > > Is there a simple way to define a new command/environment and handle > the keyword arguments in Lua? For example defining a frontend command > like this: I don't have the answer to your other questions but I do have an exampl

[NTG-context] LMTX: Command handling, Interface between TeX and Lua

2023-12-13 Thread Gerion Entrup
Hi, I'd like to understand more of the inner workings of LMTX. When I understand it right, most of the code is now processed in Lua but I was not able to find it. For example, I tried to find out how setupitemgroup is handled (just as an example of a more complex command). The wiki has a (kind

[NTG-context] Re: Combining python and lua

2023-10-26 Thread Alexandre Christe
Hi, Thanks for your inputs Aditya and Bruce. I’m still having some issues when trying to include the output of the filter module within lua. MNWE: \defineexternalfilter  [sympy]  [filtercommand={/Users/aleks/miniconda3/bin/python3 \externalfilterinputfile\space > \externalfilteroutputf

[NTG-context] Re: Combining python and lua

2023-10-25 Thread Aditya Mahajan
h. You can try checking if one of the symbolic math libraries in lua provides all the features that you want. > One possible way would be to use Python and the t-filter module, like this This can work as follows. Take the array of angles, and convert them to the desired format in python and write th

[NTG-context] Re: Combining python and lua

2023-10-25 Thread Bruce Horrocks
to \startformula \sin{\frac{\pi}{4}} = \frac{1}{2} \stopformula Then use this Lua code: local myTrigTemplate = [[ \startformula \%fname%{\frac{\pi}{%divisor%}} = \frac{%numerator%}{%denominator%} \stopformula ]] context.templates[myTrigTemplate] { fname = "s

[NTG-context] Combining python and lua

2023-10-25 Thread Alexandre Christe
rmula$ Compute trigonometric function: $\startpythonformula  from sympy import *  print(latex(cos(pi/3)))  \stoppythonformula$ \stoptext However, I haven’t managed so far to combine things (lua and Python) in an automatic way. How should I proceed? A. Christe __

[NTG-context] Re: XML: flush to lua function

2023-09-12 Thread Taco Hoekwater
tle' A short title=> ‘' A short title => 'A short title' Best wishes, Taco > On 12 Sep 2023, at 08:56, wrote: > > Ok, I’ve found a way, see below. > But maybe someone has some nice lua (or other) tricks to share… (I’m not sure > accessing t.dt[1] is particul

[NTG-context] Re: XML: flush to lua function

2023-09-12 Thread denis.maier
Ok, I've found a way, see below. But maybe someone has some nice lua (or other) tricks to share... (I'm not sure accessing t.dt[1] is particularly safe when operating on nested structures.) Best, Denis \startbuffer[test] A short title asdf asdf asdf jklö jklö jklö A longer

[NTG-context] XML: flush to lua function

2023-09-11 Thread denis.maier
Hi, I have the following xml setup with a lua function: \startluacode function markingLength(s) _,n = s:gsub("%S+","") if n > 3 then context("yes" .. " ...") else context("no")

[NTG-context] Re: escaping \ in Lua

2023-09-06 Thread Pablo Rodriguez
On 9/5/23 21:00, Hans Hagen wrote: > On 9/5/2023 6:43 PM, Pablo Rodriguez wrote: >> [...] >> Sorry for the obscure question, but how can I access this with >> "\goto{link to external}[a(b).pdf]"? > > \goto{link to external}[file(a(b).pdf)] Many thanks for your help, Hans. Pablo

[NTG-context] Fwd: escaping \ in Lua

2023-09-05 Thread Hans Hagen via ntg-context
Forwarded Message Subject: Re: [NTG-context] escaping \ in Lua Date: Tue, 5 Sep 2023 21:00:21 +0200 From: Hans Hagen To: Pablo Rodriguez On 9/5/2023 6:43 PM, Pablo Rodriguez wrote: Dear list, I have the following source: \setupinteraction[state=start, display=new

[NTG-context] escaping \ in Lua

2023-09-05 Thread Pablo Rodriguez
).pdf". Sorry for the obscure question, but how can I access this with "\goto{link to external}[a(b).pdf]"? I guess there may be some Lua magic, but I cannot write a proper ":gsub("%(", "%\%(

[NTG-context] Re: Building luametatex with Lua symbols exposed

2023-09-02 Thread Michal Vlasák
p, > when an external library is loaded in Lua. Any ideas on how to solve it? Hi Jairo, you need to expose _dynamic_ symbols in your luametatex binary. If you are using Linux, just adding the following to the CMake invocation line should work: -DCMAKE_EXECUTABLE_ENABLE_EXPORTS=1 For example

[NTG-context] Building luametatex with Lua symbols exposed

2023-08-30 Thread Jairo A. del Rio
Hi, beloved list. Since sources are in the distribution, I've tried compiling luametatex by setting LMT_STRIP in CMakeLists.txt to 0, yet the resulting binary still warns about undefined symbols, such as lua_gettop, when an external library is loaded in Lua. Any ideas on how to solve it? Thank you

[NTG-context] Re: Question about building an array of values with Lua

2023-08-25 Thread Fabrice Couvreur
ll() > context.stopxrow() > end > > Wolfgang > > > Indeed this is much more elegant… It feels so good to be on this list and > learn from such insights :-) > > > We don't even need the math.mod function because Lua added with version > 5

[NTG-context] Re: Question about building an array of values with Lua

2023-08-24 Thread Wolfgang Schuster
  context(math.mod(2*i*i,10))     context.stopxcell()     context.stopxrow()     end Wolfgang Indeed this is much more elegant… It feels so good to be on this list and learn from such insights :-) We don't even need the math.mod function because Lua added with version 5.1 a modulo

[NTG-context] Re: Question about building an array of values with Lua

2023-08-24 Thread Otared Kavian
> On 24 Aug 2023, at 06:03, Wolfgang Schuster > wrote: >> […] > > I would drop the column check in this case. > > for i = 0,9 do > context.startxrow() > context.startxcell() > context(i) > context.stopxcell() >

[NTG-context] Re: Question about building an array of values with Lua

2023-08-24 Thread Fabrice Couvreur
Hi Otared and Wolgang, Thanks for the answers. In fact, being familiar with Python and not at all with Lua, I didn't have the reflex to think of using a mathematical function which gives the remainder in the Euclidean division by 10, it's strange !! Fabrice Le jeu. 24 août 2023 à 04:06, Wolfgang

[NTG-context] Re: Question about building an array of values with Lua

2023-08-23 Thread Wolfgang Schuster
Otared Kavian schrieb am 24.08.2023 um 01:04: Hi Fabrice, As Wolfgang points out, it is indeed possible to fill-in your table with Lua: maybe you were wondering how to fill the columns 2, 3 and 4. In this case you need to use the Lua function math.mod as in the following, which

[NTG-context] Re: Question about building an array of values with Lua

2023-08-23 Thread Otared Kavian
Hi Fabrice, As Wolfgang points out, it is indeed possible to fill-in your table with Lua: maybe you were wondering how to fill the columns 2, 3 and 4. In this case you need to use the Lua function math.mod as in the following, which is a completed version of what Wolfgang sent: %% begin

[NTG-context] Re: Question about building an array of values with Lua

2023-08-23 Thread Wolfgang Schuster
Fabrice Couvreur schrieb am 23.08.2023 um 19:28: Hi, I'm trying to fill an array using lua. So far it works but then I don't know if it's possible. Where do you have problems (look into cld-mkiv.pdf for hins)? \starttext \startluacode context.startxtable{ align = "middle,lohi"

[NTG-context] Question about building an array of values with Lua

2023-08-23 Thread Fabrice Couvreur
Hi, I'm trying to fill an array using lua. So far it works but then I don't know if it's possible. Thanks Fabrice \startluacode context.startxtable({"align={middle,lohi},bodyfont=9pt,framecolor=black"}) context.startxrow({"background=color, background

[NTG-context] Re: Table head/body via lua

2023-08-18 Thread Alexey Kryukov
On Fri, 18 Aug 2023 21:11:38 +0200 Wolfgang Schuster wrote: > What you can do here is to put the table together piece by piece with > the collecting > mechanism which collect parts of the table until you flush the whole > collection > at the end with the \stopcollecting command. Many thanks,

[NTG-context] Re: Table head/body via lua

2023-08-18 Thread Wolfgang Schuster
Alexey Kryukov schrieb am 18.08.2023 um 20:31: On Fri, 18 Aug 2023 20:12:33 +0200 Wolfgang Schuster wrote: Do you create the whole table with Lua? When this is the case a small change to the table section commands on the Lua side can fix your problems but otherwise a different approach

[NTG-context] Re: Table head/body via lua

2023-08-18 Thread Alexey Kryukov
On Fri, 18 Aug 2023 20:12:33 +0200 Wolfgang Schuster wrote: > Do you create the whole table with Lua? When this is the case a small > change to the table section > commands on the Lua side can fix your problems but otherwise a > different approach is needed. Hi Wolfgang, thanks fo

[NTG-context] Re: Table head/body via lua

2023-08-18 Thread Wolfgang Schuster
Alexey Kryukov schrieb am 18.08.2023 um 19:02: Hi, I am trying to generate a table representation for some xml source. As the data structure doesn't directly correspond to the desired table structure, some manipulations via lua are required. So far everything works OK except table sectioning

[NTG-context] Table head/body via lua

2023-08-18 Thread Alexey Kryukov
Hi, I am trying to generate a table representation for some xml source. As the data structure doesn't directly correspond to the desired table structure, some manipulations via lua are required. So far everything works OK except table sectioning commands, like \bTABLEhead, \eTABLEhead, bTABLEbody

[NTG-context] Re: access image properties in Lua

2023-07-18 Thread Henning Hraban Ramm
(I assume you didn’t reply privately on purpose and take this back to the mailing list.) Am 18.07.23 um 12:47 schrieb Alan Braslau: P.S. I have not used the built-in resolution= image conversion (using gm/ImageMagik). I imagine that ConTeXt is clever enough to store the converted file so that

[NTG-context] Re: access image properties in Lua

2023-07-17 Thread Alan Braslau via ntg-context
On 17/07/23 17/07/23, 18:20, Henning Hraban Ramm wrote: Bonus question: how also to handle the case of \startMPcode draw figure "MyFigure" xsized TextWidth ; ... \stopMPcode Is MyFigure a pixel image? You could use \externalfigure within MP code. The MP operator figure calls \externalfigure.

[NTG-context] Re: access image properties in Lua

2023-07-17 Thread Henning Hraban Ramm
Am 17.07.23 um 15:44 schrieb Alan Braslau via ntg-context: On 13/07/23 13/07/23, 09:19, Hans Hagen wrote: On 7/11/2023 2:22 PM, Henning Hraban Ramm wrote: What’s the current approved way to get image properties within a Lua function? I’d like to know the pixel size and if possible also

[NTG-context] Re: access image properties in Lua

2023-07-17 Thread Alan Braslau via ntg-context
On 13/07/23 13/07/23, 09:19, Hans Hagen wrote: On 7/11/2023 2:22 PM, Henning Hraban Ramm wrote: What’s the current approved way to get image properties within a Lua function? very old: local pic = figures.getinfo(figures.current().status.fullname) used to work in 2019: local pic = img.scan

[NTG-context] Re: access image properties in Lua

2023-07-13 Thread Hans Hagen
On 7/11/2023 2:22 PM, Henning Hraban Ramm wrote: What’s the current approved way to get image properties within a Lua function? very old: local pic = figures.getinfo(figures.current().status.fullname) used to work in 2019: local pic = img.scan{filename = figures.current().status.fullname

[NTG-context] access image properties in Lua

2023-07-11 Thread Henning Hraban Ramm
What’s the current approved way to get image properties within a Lua function? very old: local pic = figures.getinfo(figures.current().status.fullname) used to work in 2019: local pic = img.scan{filename = figures.current().status.fullname} if I understand this right, "img" i

Re: [NTG-context] Minor bug in Lua or ConTeXt

2023-01-18 Thread Pablo Rodriguez via ntg-context
fined variables are fine inside \startluacode … \stopluacode. > > I bet you'd complain if \the\scratchdimen would not expand. You cannot > expect context to completely parse what goes into lua beforehand, unless > you are willing to get a performance hit (apart from a waste of time).

Re: [NTG-context] Minor bug in Lua or ConTeXt

2023-01-18 Thread Hans Hagen via ntg-context
On 1/18/2023 6:47 PM, Pablo Rodriguez via ntg-context wrote: from what I understand is that undefined TeX commands cannot be added to Lua comments. Indeed. Of course we could have some 'ignore undefined command' feature but that cripples the engine as well as then also never gives warning

Re: [NTG-context] Minor bug in Lua or ConTeXt

2023-01-18 Thread Pablo Rodriguez via ntg-context
On 1/18/23 14:41, Bruce Horrocks via ntg-context wrote: > […] > Perhaps the Wiki only needs to point out that if you get a Lua > related error and the error log lists the entire contents of \startluacode ... > \stopluacode then a possible source of the error is a \comma

Re: [NTG-context] Minor bug in Lua or ConTeXt

2023-01-18 Thread Bruce Horrocks via ntg-context
Thanks Hans. Before Pablo spends too much effort on the wiki it's worth pointing out that this only happened because I was in-line documenting the Lua function that I had written and wanted to name the ConTeXT macro that would invoke it - so it's trivial for me to avoid this error. Perhaps

Re: [NTG-context] Minor bug in Lua or ConTeXt

2023-01-18 Thread Hans Hagen via ntg-context
On 1/18/2023 12:36 AM, Bruce Horrocks via ntg-context wrote: ConTeXt ver: 2023.01.04 The following MWE won't compile because of the \dummycommand line even though it is a comment. Not sure whether it's a minor bug or an unavoidable aspect of allowing embedded Lua. \startluacode

Re: [NTG-context] Minor bug in Lua or ConTeXt

2023-01-18 Thread Pablo Rodriguez via ntg-context
On 1/18/23 00:36, Bruce Horrocks via ntg-context wrote: > ConTeXt ver: 2023.01.04 > > The following MWE won't compile because of the \dummycommand line > even though it is a comment. Not sure whether it's a minor bug or an > unavoidable aspect of allowing embedded Lua. Hi Bruce

[NTG-context] Minor bug in Lua or ConTeXt

2023-01-17 Thread Bruce Horrocks via ntg-context
ConTeXt ver: 2023.01.04 The following MWE won't compile because of the \dummycommand line even though it is a comment. Not sure whether it's a minor bug or an unavoidable aspect of allowing embedded Lua. \startluacode -- \dummycommand \stopluacode \starttext Hello \stoptext — Bruce Horrocks

Re: [NTG-context] Xml filtering in Lua

2022-11-21 Thread Thomas A. Schmitz via ntg-context
On 11/20/22 19:19, Thomas A. Schmitz via ntg-context wrote: I load data from an external xml file (not the one I'm processing) and store some of it in a lua table. local examples = lxml.load ("my_examples", "examples.xml") Replying to myself, and sorry for the noise (

Re: [NTG-context] Xml filtering in Lua

2022-11-20 Thread Thomas A. Schmitz via ntg-context
stumbling upon a problem I can't solve. It's difficult to make a minimal example, so bear with some snippets. I load data from an external xml file (not the one I'm processing) and store some of it in a lua table. local examples = lxml.load ("my_examples", "examples.x

Re: [NTG-context] Xml filtering in Lua

2022-11-17 Thread Thomas A. Schmitz via ntg-context
Hans I think this is exactly the approach I’m looking for: collecting everything in Lua tables and then retrieving and typesetting it later. I’m experimenting with it right now. I will have to define a proper lxml.command for every xml tag, I guess; otherwise, the xml gets serialized? I’ll play

Re: [NTG-context] Xml filtering in Lua

2022-11-17 Thread Hans Hagen via ntg-context
On 11/16/2022 8:56 PM, mf via ntg-context wrote: This works: local metadata = xml.filter (t, '../../topics/topic[@t:id=="' .. ch_id .. '"]') also this: local lpath = string.format('../../topics/topic[@t:id=="%s"]', ch_id) local metadata = xml.filter (t, lpath) It looks like xml.filter

Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread Hans Hagen via ntg-context
On 11/16/2022 10:09 PM, Thomas A. Schmitz via ntg-context wrote: On 11/16/22 21:51, Denis Maier via ntg-context wrote: Just a quick question regarding this? Is xml.filter equivalent to \xmlfilter? If so, how do you pass the match to a command as you'd do with \xmlfilter? I'm still digesting

Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread Thomas A. Schmitz via ntg-context
On 11/16/22 21:51, Denis Maier via ntg-context wrote: Just a quick question regarding this? Is xml.filter equivalent to \xmlfilter? If so, how do you pass the match to a command as you'd do with \xmlfilter? I'm still digesting and playing with Massi's reply; will probably be back with more

Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread Denis Maier via ntg-context
16. November 2022 20:56 > An: ntg-context@ntg.nl > Cc: mf > Betreff: Re: [NTG-context] Xml filtering in Lua > > This works: > > local metadata = xml.filter (t, '../../topics/topic[@t:id=="' .. ch_id .. > '"]') > > also this: > > local lpath = string.f

Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread mf via ntg-context
This works: local metadata = xml.filter (t, '../../topics/topic[@t:id=="' .. ch_id .. '"]') also this: local lpath = string.format('../../topics/topic[@t:id=="%s"]', ch_id) local metadata = xml.filter (t, lpath) It looks like xml.filter supports only 2 arguments (see lxml-tex.lua), and

Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread Thomas A. Schmitz via ntg-context
On 11/16/22 19:56, mf via ntg-context wrote: local ch_id = t.at["ch:id"] You're right, of course, using a colon was a stupid idea. When I replace it with an underscore, you can see that both are in fact identical: \startbuffer[test] This is the first test 22/11/16

Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread mf via ntg-context
Il 16/11/22 18:33, Thomas A. Schmitz via ntg-context ha scritto: \startbuffer[test] This is the first test 22/11/16 This is the second test 22/11/17 This will be the content of the first chapter.

Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread Thomas A. Schmitz via ntg-context
Hi Duncan, Thank you for pointing this out! I knew this was true inside the xmlns namespace, so you can’t have identical xml:id tags, but you’re probably right that it’s better to avoid this confusion altogether. Alas, this doesn’t help with my problem. Since there was a type in my minimal

Re: [NTG-context] Xml filtering in Lua

2022-11-16 Thread Duncan Hothersall via ntg-context
Hi Thomas. I'm not sure about the code, sorry, but I do know that an XML document can't have two IDs of the same value. Typically you would use a linkend attribute on the element which is referencing an id (in this case the topics, I think). Probably doesn't help with your problem, but it's

[NTG-context] Xml filtering in Lua

2022-11-16 Thread Thomas A. Schmitz via ntg-context
Hi all, I thought this was easy, but I overestimated my competence… I want to filter xml elements via their attributes and retrieve and typeset parts belonging together. Here is a small test file that explains what I’m trying: \startbuffer[test] This is the first test

Re: [NTG-context] Create the values of a sequence with Lua

2022-10-31 Thread Aditya Mahajan via ntg-context
On Mon, 31 Oct 2022, Fabrice Couvreur via ntg-context wrote: > Hi, > The idea is to fill the array with the sequence defined by > p(0) = 0.3 and p(n + 1) = 0.3 + 0.7*p(n) > The problem is that I don't really master Lua but I will learn when I have > some time! > Thanks for yo

[NTG-context] Create the values of a sequence with Lua

2022-10-31 Thread Fabrice Couvreur via ntg-context
Hi, The idea is to fill the array with the sequence defined by p(0) = 0.3 and p(n + 1) = 0.3 + 0.7*p(n) The problem is that I don't really master Lua but I will learn when I have some time! Thanks for your help. Fabrice \starttext \startluacode context.startxtable({"align={middle,lohi},widt

Re: [NTG-context] accessing tex.sprint from pure Lua code.

2022-08-30 Thread Hans Hagen via ntg-context
On 8/30/2022 8:02 PM, Hans van der Meer wrote: In Terminal (say Unix window) calling lua some-file.lua and within that file code like tex.sprint ... token... Thus calling in the tex-library outside ConTeXt. no, tex is not a library .. but of course you can make a small tex file that wraps

Re: [NTG-context] accessing tex.sprint from pure Lua code.

2022-08-30 Thread Hans Hagen via ntg-context
On 8/30/2022 7:34 PM, Hans van der Meer via ntg-context wrote: How can ik access the tex library in pure Lua for tex.sprint and token.setmacro? I guess something like require XYZ ? what do you mean with pure lua Hans

[NTG-context] accessing tex.sprint from pure Lua code.

2022-08-30 Thread Hans van der Meer via ntg-context
How can ik access the tex library in pure Lua for tex.sprint and token.setmacro? I guess something like require XYZ ? dr. Hans van der Meer ___ If your question is of interest to others as well, please add an entry

Re: [NTG-context] Merging two lua tables

2022-08-30 Thread BPJ via ntg-context
v: > >> On 8/29/2022 7:33 PM, BPJ via ntg-context wrote: >> > Hi, >> > >> > I use the attached Lua function to merge array, map and mixed tables >> alike >> > (but differently! :-) The trick is to check if each key is numeric or >> not,

Re: [NTG-context] Merging two lua tables

2022-08-30 Thread BPJ via ntg-context
Den mån 29 aug. 2022 20:13Hans Hagen via ntg-context skrev: > On 8/29/2022 7:33 PM, BPJ via ntg-context wrote: > > Hi, > > > > I use the attached Lua function to merge array, map and mixed tables > alike > > (but differently! :-) The trick is to check if each key i

Re: [NTG-context] Merging two lua tables

2022-08-29 Thread Aditya Mahajan via ntg-context
On Mon, 29 Aug 2022, Hans Hagen via ntg-context wrote: > On 8/29/2022 2:20 PM, Aditya Mahajan via ntg-context wrote: > > Hi, > > > > How do I merge two lua tables? I believe that table.merge or table.merged > should do the trick, but I cannot figure out how to use them. &

Re: [NTG-context] Merging two lua tables

2022-08-29 Thread Hans Hagen via ntg-context
On 8/29/2022 7:33 PM, BPJ via ntg-context wrote: Hi, I use the attached Lua function to merge array, map and mixed tables alike (but differently! :-) The trick is to check if each key is numeric or not, append if it is and overwrite if it isn't. you really want something like

Re: [NTG-context] Merging two lua tables

2022-08-29 Thread BPJ via ntg-context
Hi, I use the attached Lua function to merge array, map and mixed tables alike (but differently! :-) The trick is to check if each key is numeric or not, append if it is and overwrite if it isn't. This function just ignores non-table arguments because that is what I usually want. You may want

Re: [NTG-context] Merging two lua tables

2022-08-29 Thread Hans Hagen via ntg-context
On 8/29/2022 2:20 PM, Aditya Mahajan via ntg-context wrote: Hi, How do I merge two lua tables? I believe that table.merge or table.merged should do the trick, but I cannot figure out how to use them. ``` local t1 = { 1, 2 } local t2 = { 8, 9 } local m1 = {} table.merge(m1,t1, t2) table.print

Re: [NTG-context] Merging two lua tables

2022-08-29 Thread Aditya Mahajan via ntg-context
On Mon, 29 Aug 2022, Aditya Mahajan via ntg-context wrote: > Hi, > > How do I merge two lua tables? I believe that table.merge or table.merged > should do the trick, but I cannot figure out how to use them. > > ``` > local t1 = { 1, 2 } > local t2 = { 8, 9 } > &g

[NTG-context] Merging two lua tables

2022-08-29 Thread Aditya Mahajan via ntg-context
Hi, How do I merge two lua tables? I believe that table.merge or table.merged should do the trick, but I cannot figure out how to use them. ``` local t1 = { 1, 2 } local t2 = { 8, 9 } local m1 = {} table.merge(m1,t1, t2) table.print(m1) local m2 = table.merged(t1, t2) table.print(m2

Re: [NTG-context] Accessing inserts from Lua in LuaMetaTeX

2022-08-15 Thread Max Chernoff via ntg-context
e don't use these boxes and registers because we run in > \insertmode=2. This gives us more state info (i kept the old method > around for now). Inserts always felt a little hacky in TeX, so I think that the new methods are a huge improvement. > > Second, how do I get the head

Re: [NTG-context] Accessing inserts from Lua in LuaMetaTeX

2022-08-15 Thread Hans Hagen via ntg-context
On 8/15/2022 8:18 AM, Max Chernoff via ntg-context wrote: Hi all, I'm trying to manipulate some inserts from Lua in LuaMetaTeX, and I'm having some problems that I'm not having with LuaTeX. First, how do I get an insert's class/type from the "insert" nodes on the page? W

[NTG-context] Accessing inserts from Lua in LuaMetaTeX

2022-08-15 Thread Max Chernoff via ntg-context
Hi all, I'm trying to manipulate some inserts from Lua in LuaMetaTeX, and I'm having some problems that I'm not having with LuaTeX. First, how do I get an insert's class/type from the "insert" nodes on the page? With LuaTeX, the insert's class/type is the same as the subtype of the &

Re: [NTG-context] issue in Lua syntax formatting

2022-06-01 Thread Henning Hraban Ramm via ntg-context
Am 01.06.22 um 02:39 schrieb Max Chernoff: the formatting of Lua multi-line strings messes up the source structure, in the following MWE, the "one" is displayed after "[[": I can reproduce this. As a workaround, you can insert a non-breaking space (U+00A0) immediately af

Re: [NTG-context] issue in Lua syntax formatting

2022-05-31 Thread Max Chernoff via ntg-context
the formatting of Lua multi-line strings messes up the source structure, in the following MWE, the "one" is displayed after "[[": \starttext \startLUA words = [[ one two three ]] \stopLUA \stoptext I can reproduce this. As a workaround, you can insert a non-bre

[NTG-context] issue in Lua syntax formatting

2022-05-30 Thread Henning Hraban Ramm via ntg-context
Hi, the formatting of Lua multi-line strings messes up the source structure, in the following MWE, the "one" is displayed after "[[": \starttext \startLUA words = [[ one two three ]] \stopLUA \stoptext (Denis recognized that in his MAPS/CGJ article on ligatur

Re: [NTG-context] lua-widow-control module error in LMTX

2022-05-14 Thread Max Chernoff via ntg-context
Hi all, I've pushed lwc v2.1.0 to CTAN and the Garden Modules site. This new version fully supports the ConTeXt grid snapping (MkIV/MkXL), and it also adds some improved logging. You can download this directly at https://modules.contextgarden.net/dl/lua-widow-control-v2.1.0.zip I

Re: [NTG-context] Citeproc-lua

2022-05-07 Thread Denis Maier via ntg-context
> -Ursprüngliche Nachricht- > Von: Hans Hagen > Gesendet: Samstag, 7. Mai 2022 01:15 > An: Maier, Denis Christian (UB) ; ntg-context@ntg.nl > Betreff: Re: AW: [NTG-context] Citeproc-lua > > On 5/7/2022 12:33 AM, denis.ma...@unibe.ch wrote: > >> -Ursprün

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Hans Hagen via ntg-context
On 5/7/2022 12:33 AM, denis.ma...@unibe.ch wrote: -Ursprüngliche Nachricht- Von: ntg-context Im Auftrag von Hans Hagen via ntg-context Gesendet: Freitag, 6. Mai 2022 23:45 An: Denis Maier via ntg-context Cc: Hans Hagen Betreff: Re: [NTG-context] Citeproc-lua [...] For the record: i

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Rik Kabel via ntg-context
On 2022-05-06 17:44, Hans Hagen via ntg-context wrote: [...] A bit like this: - Convert the whole bibliography database to html using pandoc in the preferred cs rendering. That should be fast. - Use the normal context commands for referencing a citation (the cite part is normally easy as

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Denis Maier via ntg-context
> -Ursprüngliche Nachricht- > Von: ntg-context Im Auftrag von Hans Hagen > via ntg-context > Gesendet: Freitag, 6. Mai 2022 23:45 > An: Denis Maier via ntg-context > Cc: Hans Hagen > Betreff: Re: [NTG-context] Citeproc-lua > > [...] > > For the recor

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Denis Maier via ntg-context
Yes, Aditya. Citeproc-lua uses csl styles. Test suite coverage is not complete yet, though. Denis Von: ntg-context im Auftrag von Hans Hagen via ntg-context Gesendet: Freitag, 6. Mai 2022 23:44:38 An: Denis Maier via ntg-context Cc: Hans Hagen

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Hans Hagen via ntg-context
s the main task would be to come up with an equivalent ConTeXt module that writes the citations to the tuc file, calls the citeproc engine, and uses the results for the output. Right? (I.e., AFAICS, everything that lives under https://github.com/zepinglee/citeproc-lua/tree/main/citeproc should p

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Hans Hagen via ntg-context
eXt module that writes the citations to the tuc file, calls the citeproc engine, and uses the results for the output. Right? (I.e., AFAICS, everything that lives under https://github.com/zepinglee/citeproc-lua/tree/main/citeproc should pretty much just work, while https://github.com/zepinglee/ci

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Aditya Mahajan via ntg-context
equivalent > ConTeXt module that writes the citations to the tuc file, calls the citeproc > engine, and uses the results for the output. Right? (I.e., AFAICS, everything > that lives under https://github.com/zepinglee/citeproc-lua/tree/main/citeproc > should pretty much just work, whil

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Denis Maier via ntg-context
ight? (I.e., AFAICS, everything that lives under https://github.com/zepinglee/citeproc-lua/tree/main/citeproc should pretty much just work, while https://github.com/zepinglee/citeproc-lua/tree/main/latex must be adapted.) For the record: the relevant stuff in the aux file looks like this: \bib

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Hans Hagen via ntg-context
On 5/6/2022 2:57 PM, Taco Hoekwater via ntg-context wrote: But: I personally do not understand how to do the integration with ConTeXt’s new biblio system. I only understand half of what ConTeXt does these days, and much less of what the LaTeX package is trying to achieve i.r.t. options. i'll

Re: [NTG-context] Citeproc-lua

2022-05-06 Thread Taco Hoekwater via ntg-context
Hi, I had a quick look at this and it seems very extensible if-not-quite ConTeXt-ready right away. On the input side, it reads a LaTeX .aux file to parse things like options, databases, and requested citations. For this, it uses a dedicated “citeproc” lua script that should be easy to modify

[NTG-context] Citeproc-lua

2022-05-03 Thread Denis Maier via ntg-context
Hi, I just came across this: https://github.com/zepinglee/citeproc-lua Thats's an lua implemenation of the CSL language targeting LaTeX. I don't know if the processor itself contains any LaTeX specific code, but it looks like the integration basically happens here : https://github.com/zepinglee

[NTG-context] \doifnotdocumentargument in proper Lua

2022-04-29 Thread Pablo Rodriguez via ntg-context
Dear list, I have the following command in one of my documents: \doifnotdocumentargument{no-metadata} {\ctxlua{document.transfer_metadata(document.main_file)}} Which would be the right way to write \doifnotdocumentargument in proper Lua? Many thanks for your help, Pablo

Re: [NTG-context] lua-widow-control module error in LMTX

2022-04-29 Thread Eduardo Bohoyo via ntg-context
l 29/4/22 a las 2:38, Max Chernoff escribió: On 2022-04-28 3:30 a.m., Henning Hraban Ramm wrote: I’m afraid the above release introduced a bug; while the offical release ran through, I now get: module  > lua-widow-control > Widow/orphan detected. Attempting to remove. lua error

Re: [NTG-context] lua-widow-control module error in LMTX

2022-04-28 Thread Max Chernoff via ntg-context
On 2022-04-28 3:30 a.m., Henning Hraban Ramm wrote: I’m afraid the above release introduced a bug; while the offical release ran through, I now get: module  > lua-widow-control > Widow/orphan detected. Attempting to remove. lua error       > lua error on line 112 i

Re: [NTG-context] lua-widow-control module error in LMTX

2022-04-28 Thread Henning Hraban Ramm via ntg-context
Am 28.04.22 um 12:54 schrieb Eduardo Bohoyo via ntg-context: Hi Max: Here testing that beta version. As you know, my book is in grid mode, but I get the same error message as Hraban when the compilation crashes. However, when I comment grid again in my document, it does compile the pdf.

Re: [NTG-context] lua-widow-control module error in LMTX

2022-04-28 Thread Eduardo Bohoyo via ntg-context
-negotiable part of my code. I _think_ that I've fixed it now. Can you try the beta version at https://github.com/gucci-on-fleek/lua-widow-control/releases/tag/release-47ff19d9804f6ecea64dda59426664680d9756e0 please? Hopefully this solves the issue. Do you want the new pdf with lwc actually acting

Re: [NTG-context] lua-widow-control module error in LMTX

2022-04-28 Thread Henning Hraban Ramm via ntg-context
Am 28.04.22 um 09:25 schrieb Max Chernoff via ntg-context: I _think_ that I've fixed it now. Can you try the beta version at https://github.com/gucci-on-fleek/lua-widow-control/releases/tag/release-47ff19d9804f6ecea64dda59426664680d9756e0 please? Hopefully this solves the issue. Hi

  1   2   3   4   5   6   7   8   9   10   >